/*
GANESHA - Reasoning on critical infrastructures affected by emergency situations
Copyright (c) 2010-2011, Information Eng. Research Unit - Univ. of Alcala
http://www.cc.uah.es/ie
This library is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by the Free
Software Foundation; either version 2.1 of the License, or (at your option)
any later version.
This library is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
details.
You should have received a copy of the GNU Lesser General Public License along
with this library; if not, write to the Free Software Foundation, Inc.,
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 */
package es.uah.cc.ie.ganesha.ontologies;

import es.uah.cc.ie.ganesha.GANESHAConfiguration;
import es.uah.cc.ie.ganesha.nodes.NodeInfo;
import java.io.IOException;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.jdom.JDOMException;

/**
 *
 * @author ieru
 */
public class OntologyAccessSample {

	public static void main(String[] args) {
		try {
			PersistentOntology.ONTOLOGY_WORK_WITH_FILES = true;

			GANESHAConfiguration config = new GANESHAConfiguration("../PruebaEjecucion/config.xml");

			OntologyNodes ont = OntologyNodes.accessOntology(config);

			for (NodeInfo node : ont.getAllNodes()) {
				System.out.println(node.toString());
			}

			List<String> dominios = ont.getDomains();

			for (String dominio : dominios) {
				System.out.println("Dominio: " + dominio);

				List<NodeInfo> nodos_dominio = ont.getAllNodes(dominio);

				for (NodeInfo nodo : nodos_dominio) {
					System.out.println(nodo.toString());
				}
			}


		} catch (JDOMException ex) {
			Logger.getLogger(OntologyAccessSample.class.getName()).log(Level.SEVERE, null, ex);
		} catch (IOException ex) {
			Logger.getLogger(OntologyAccessSample.class.getName()).log(Level.SEVERE, null, ex);
		}

	}
}
